# **********************************************************************
#
# Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************

# Ice version 3.3.1
# Generated from file `Servo.ice'

import Ice, IcePy, __builtin__

if not Ice.__dict__.has_key("_struct_marker"):
    Ice._struct_marker = object()
import TeRKCommon_ice

# Included module Ice
_M_Ice = Ice.openModule('Ice')

# Included module Glacier2
_M_Glacier2 = Ice.openModule('Glacier2')

# Included module peer
_M_peer = Ice.openModule('peer')

# Included module TeRK
_M_TeRK = Ice.openModule('TeRK')

# Start of module TeRK
__name__ = 'TeRK'

if not _M_TeRK.__dict__.has_key('ServoMode'):
    _M_TeRK.ServoMode = Ice.createTempClass()
    class ServoMode(object):

        def __init__(self, val):
            #assert(val >= 0 and val < 3)
            self.value = val

        def __str__(self):
            if self.value == 0:
                return 'ServoMotorSpeedControl'
            elif self.value == 1:
                return 'ServoMotorPositionControl'
            elif self.value == 2:
                return 'ServoOff'
            return None

        __repr__ = __str__

        def __hash__(self):
            return self.value

        def __cmp__(self, other):
            return cmp(self.value, other.value)

    ServoMode.ServoMotorSpeedControl = ServoMode(0)
    ServoMode.ServoMotorPositionControl = ServoMode(1)
    ServoMode.ServoOff = ServoMode(2)

    _M_TeRK._t_ServoMode = IcePy.defineEnum('::TeRK::ServoMode', ServoMode, (), (ServoMode.ServoMotorSpeedControl, ServoMode.ServoMotorPositionControl, ServoMode.ServoOff))

    _M_TeRK.ServoMode = ServoMode
    del ServoMode

if not _M_TeRK.__dict__.has_key('_t_ServoModeArray'):
    _M_TeRK._t_ServoModeArray = IcePy.defineSequence('::TeRK::ServoModeArray', (), _M_TeRK._t_ServoMode)

if not _M_TeRK.__dict__.has_key('Bounds'):
    _M_TeRK.Bounds = Ice.createTempClass()
    class Bounds(object):
        def __init__(self, min=0, max=0):
            self.min = min
            self.max = max

        def __hash__(self):
            _h = 0
            _h = 5 * _h + __builtin__.hash(self.min)
            _h = 5 * _h + __builtin__.hash(self.max)
            return _h % 0x7fffffff

        def __cmp__(self, other):
            if other == None:
                return 1
            if self.min < other.min:
                return -1
            elif self.min > other.min:
                return 1
            if self.max < other.max:
                return -1
            elif self.max > other.max:
                return 1
            return 0

        def __str__(self):
            return IcePy.stringify(self, _M_TeRK._t_Bounds)

        __repr__ = __str__

    _M_TeRK._t_Bounds = IcePy.defineStruct('::TeRK::Bounds', Bounds, (), (
        ('min', (), IcePy._t_int),
        ('max', (), IcePy._t_int)
    ))

    _M_TeRK.Bounds = Bounds
    del Bounds

if not _M_TeRK.__dict__.has_key('_t_BoundsArray'):
    _M_TeRK._t_BoundsArray = IcePy.defineSequence('::TeRK::BoundsArray', (), _M_TeRK._t_Bounds)

if not _M_TeRK.__dict__.has_key('ServoCommandException'):
    _M_TeRK.ServoCommandException = Ice.createTempClass()
    class ServoCommandException(_M_TeRK.CommandException):
        def __init__(self, reason=''):
            _M_TeRK.CommandException.__init__(self, reason)

        def ice_name(self):
            return 'TeRK::ServoCommandException'

        def __str__(self):
            return IcePy.stringifyException(self)

        __repr__ = __str__

    _M_TeRK._t_ServoCommandException = IcePy.defineException('::TeRK::ServoCommandException', ServoCommandException, (), _M_TeRK._t_CommandException, ())
    ServoCommandException.ice_type = _M_TeRK._t_ServoCommandException

    _M_TeRK.ServoCommandException = ServoCommandException
    del ServoCommandException

if not _M_TeRK.__dict__.has_key('ServoConfig'):
    _M_TeRK.ServoConfig = Ice.createTempClass()
    class ServoConfig(object):
        def __init__(self, rangeBounds=Ice._struct_marker, initialPosition=0):
            if rangeBounds is Ice._struct_marker:
                self.rangeBounds = _M_TeRK.Bounds()
            else:
                self.rangeBounds = rangeBounds
            self.initialPosition = initialPosition

        def __hash__(self):
            _h = 0
            _h = 5 * _h + __builtin__.hash(self.rangeBounds)
            _h = 5 * _h + __builtin__.hash(self.initialPosition)
            return _h % 0x7fffffff

        def __cmp__(self, other):
            if other == None:
                return 1
            if self.rangeBounds < other.rangeBounds:
                return -1
            elif self.rangeBounds > other.rangeBounds:
                return 1
            if self.initialPosition < other.initialPosition:
                return -1
            elif self.initialPosition > other.initialPosition:
                return 1
            return 0

        def __str__(self):
            return IcePy.stringify(self, _M_TeRK._t_ServoConfig)

        __repr__ = __str__

    _M_TeRK._t_ServoConfig = IcePy.defineStruct('::TeRK::ServoConfig', ServoConfig, (), (
        ('rangeBounds', (), _M_TeRK._t_Bounds),
        ('initialPosition', (), IcePy._t_int)
    ))

    _M_TeRK.ServoConfig = ServoConfig
    del ServoConfig

if not _M_TeRK.__dict__.has_key('_t_ServoConfigArray'):
    _M_TeRK._t_ServoConfigArray = IcePy.defineSequence('::TeRK::ServoConfigArray', (), _M_TeRK._t_ServoConfig)

if not _M_TeRK.__dict__.has_key('ServoState'):
    _M_TeRK.ServoState = Ice.createTempClass()
    class ServoState(object):
        def __init__(self, servoPositions=None):
            self.servoPositions = servoPositions

        def __hash__(self):
            _h = 0
            if self.servoPositions:
                for _i0 in self.servoPositions:
                    _h = 5 * _h + __builtin__.hash(_i0)
            return _h % 0x7fffffff

        def __cmp__(self, other):
            if other == None:
                return 1
            if self.servoPositions < other.servoPositions:
                return -1
            elif self.servoPositions > other.servoPositions:
                return 1
            return 0

        def __str__(self):
            return IcePy.stringify(self, _M_TeRK._t_ServoState)

        __repr__ = __str__

    _M_TeRK._t_ServoState = IcePy.defineStruct('::TeRK::ServoState', ServoState, (), (('servoPositions', (), _M_TeRK._t_IntArray),))

    _M_TeRK.ServoState = ServoState
    del ServoState

if not _M_TeRK.__dict__.has_key('ServoCommand'):
    _M_TeRK.ServoCommand = Ice.createTempClass()
    class ServoCommand(object):
        def __init__(self, servoMask=None, servoModes=None, servoPositions=None, servoSpeeds=None):
            self.servoMask = servoMask
            self.servoModes = servoModes
            self.servoPositions = servoPositions
            self.servoSpeeds = servoSpeeds

        def __hash__(self):
            _h = 0
            if self.servoMask:
                for _i0 in self.servoMask:
                    _h = 5 * _h + __builtin__.hash(_i0)
            if self.servoModes:
                for _i1 in self.servoModes:
                    _h = 5 * _h + __builtin__.hash(_i1)
            if self.servoPositions:
                for _i2 in self.servoPositions:
                    _h = 5 * _h + __builtin__.hash(_i2)
            if self.servoSpeeds:
                for _i3 in self.servoSpeeds:
                    _h = 5 * _h + __builtin__.hash(_i3)
            return _h % 0x7fffffff

        def __cmp__(self, other):
            if other == None:
                return 1
            if self.servoMask < other.servoMask:
                return -1
            elif self.servoMask > other.servoMask:
                return 1
            if self.servoModes < other.servoModes:
                return -1
            elif self.servoModes > other.servoModes:
                return 1
            if self.servoPositions < other.servoPositions:
                return -1
            elif self.servoPositions > other.servoPositions:
                return 1
            if self.servoSpeeds < other.servoSpeeds:
                return -1
            elif self.servoSpeeds > other.servoSpeeds:
                return 1
            return 0

        def __str__(self):
            return IcePy.stringify(self, _M_TeRK._t_ServoCommand)

        __repr__ = __str__

    _M_TeRK._t_ServoCommand = IcePy.defineStruct('::TeRK::ServoCommand', ServoCommand, (), (
        ('servoMask', (), _M_TeRK._t_BooleanArray),
        ('servoModes', (), _M_TeRK._t_ServoModeArray),
        ('servoPositions', (), _M_TeRK._t_IntArray),
        ('servoSpeeds', (), _M_TeRK._t_IntArray)
    ))

    _M_TeRK.ServoCommand = ServoCommand
    del ServoCommand

if not _M_TeRK.__dict__.has_key('ServoController'):
    _M_TeRK.ServoController = Ice.createTempClass()
    class ServoController(_M_TeRK.AbstractCommandController):
        def __init__(self):
            if __builtin__.type(self) == _M_TeRK.ServoController:
                raise RuntimeError('TeRK.ServoController is an abstract class')

        def ice_ids(self, current=None):
            return ('::Ice::Object', '::TeRK::AbstractCommandController', '::TeRK::PropertyManager', '::TeRK::ServoController')

        def ice_id(self, current=None):
            return '::TeRK::ServoController'

        def ice_staticId():
            return '::TeRK::ServoController'
        ice_staticId = staticmethod(ice_staticId)

        #
        # Operation signatures.
        #
        # def execute(self, command, current=None):
        # def setBounds(self, servoMask, servoBounds, current=None):
        # def getBounds(self, current=None):
        # def setConfigs(self, servoMask, servoConfigs, current=None):
        # def getConfigs(self, current=None):

        def __str__(self):
            return IcePy.stringify(self, _M_TeRK._t_ServoController)

        __repr__ = __str__

    _M_TeRK.ServoControllerPrx = Ice.createTempClass()
    class ServoControllerPrx(_M_TeRK.AbstractCommandControllerPrx):

        def execute(self, command, _ctx=None):
            return _M_TeRK.ServoController._op_execute.invoke(self, ((command, ), _ctx))

        def execute_async(self, _cb, command, _ctx=None):
            return _M_TeRK.ServoController._op_execute.invokeAsync(self, (_cb, (command, ), _ctx))

        def setBounds(self, servoMask, servoBounds, _ctx=None):
            return _M_TeRK.ServoController._op_setBounds.invoke(self, ((servoMask, servoBounds), _ctx))

        def setBounds_async(self, _cb, servoMask, servoBounds, _ctx=None):
            return _M_TeRK.ServoController._op_setBounds.invokeAsync(self, (_cb, (servoMask, servoBounds), _ctx))

        def getBounds(self, _ctx=None):
            return _M_TeRK.ServoController._op_getBounds.invoke(self, ((), _ctx))

        def getBounds_async(self, _cb, _ctx=None):
            return _M_TeRK.ServoController._op_getBounds.invokeAsync(self, (_cb, (), _ctx))

        def setConfigs(self, servoMask, servoConfigs, _ctx=None):
            return _M_TeRK.ServoController._op_setConfigs.invoke(self, ((servoMask, servoConfigs), _ctx))

        def setConfigs_async(self, _cb, servoMask, servoConfigs, _ctx=None):
            return _M_TeRK.ServoController._op_setConfigs.invokeAsync(self, (_cb, (servoMask, servoConfigs), _ctx))

        def getConfigs(self, _ctx=None):
            return _M_TeRK.ServoController._op_getConfigs.invoke(self, ((), _ctx))

        def getConfigs_async(self, _cb, _ctx=None):
            return _M_TeRK.ServoController._op_getConfigs.invokeAsync(self, (_cb, (), _ctx))

        def checkedCast(proxy, facetOrCtx=None, _ctx=None):
            return _M_TeRK.ServoControllerPrx.ice_checkedCast(proxy, '::TeRK::ServoController', facetOrCtx, _ctx)
        checkedCast = staticmethod(checkedCast)

        def uncheckedCast(proxy, facet=None):
            return _M_TeRK.ServoControllerPrx.ice_uncheckedCast(proxy, facet)
        uncheckedCast = staticmethod(uncheckedCast)

    _M_TeRK._t_ServoControllerPrx = IcePy.defineProxy('::TeRK::ServoController', ServoControllerPrx)

    _M_TeRK._t_ServoController = IcePy.defineClass('::TeRK::ServoController', ServoController, (), True, None, (_M_TeRK._t_AbstractCommandController,), ())
    ServoController.ice_type = _M_TeRK._t_ServoController

    ServoController._op_execute = IcePy.Operation('execute', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (((), _M_TeRK._t_ServoCommand),), (), _M_TeRK._t_ServoState, (_M_TeRK._t_ServoCommandException,))
    ServoController._op_setBounds = IcePy.Operation('setBounds', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (((), _M_TeRK._t_BooleanArray), ((), _M_TeRK._t_BoundsArray)), (), None, ())
    ServoController._op_getBounds = IcePy.Operation('getBounds', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (), (), _M_TeRK._t_BoundsArray, ())
    ServoController._op_setConfigs = IcePy.Operation('setConfigs', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (((), _M_TeRK._t_BooleanArray), ((), _M_TeRK._t_ServoConfigArray)), (), None, ())
    ServoController._op_getConfigs = IcePy.Operation('getConfigs', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (), (), _M_TeRK._t_ServoConfigArray, ())

    _M_TeRK.ServoController = ServoController
    del ServoController

    _M_TeRK.ServoControllerPrx = ServoControllerPrx
    del ServoControllerPrx

# End of module TeRK
